import { userCollectGet } from "@/api/user";
import Course from "@/components/course";
import CustomNavBar from "@/components/custom-nav";
import { useUserStore } from "@/store/user";
import React, { useState, useEffect } from "react";

type Props = {};

export default function Collect({}: Props) {
  const { userInfo } = useUserStore((state) => state);
  const [list, setList] = useState([]);
  useEffect(() => {
    if (userInfo) {
      let userid = userInfo.objectId;
      userCollectGet({ userid }).then((res) => {
        setList(res.data.results);
      });
    }
  }, []);
  return (
    <div>
      <CustomNavBar title="我的收藏" />
      <Course list={list} isCollect />
    </div>
  );
}
